<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>请假审批</title>
<meta name="description" content="">
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet" href="${s.base}/phone/css/common.css">
<link rel="stylesheet" href="${s.base}/phone/css/font-awesome.css">
</head>
<body>
<input type="hidden" id="leaveId" value="${msgLeave.leaveId}"/>
<input type="hidden" id="personType" value="${personType}">
<input type="hidden" id="id" value="${id}">
	<div class="dynamics">
		<div class="choose">请假人:<span>${msgLeave.studentName}</span></div>
		<div class="choose">开始时间:<span>${msgLeave.startTime?string("yyyy-MM-dd")}</span></div>
		<div class="choose">结束时间:<span>${msgLeave.endTime?string('yyyy-MM-dd')}</span></div>
		<div class="choose">当前状态:<span>
			<#if msgLeave.status=='1'>等待审核</#if>
			<#if msgLeave.status=='2'>已查看</#if>
			<#if msgLeave.status=='3'>审核通过</#if>
			<#if msgLeave.status=='4'>审核未通过</#if>
		</span>
		</div>
		<div class="choose">提交人:<span>${msgLeave.creatorName}</span></div>
		<div class="choose">审核人:<span>${msgLeave.replyName}</span></div>
		<div class="choose">提交时间:<span>${msgLeave.createTime?string('yyyy-MM-dd hh:mm:ss')}</span></div>
		<div class="Editor">
			请假事由:<br/>
			<textarea rows="5" placeholder="请假事由">${msgLeave.content}
			</textarea>
		</div>
	</div>
	<#if msgLeave.replyId==id && (msgLeave.status==1 || msgLeave.status==2)>
	<div class="dynamics-group">
		<input type="button" onclick="submitContent('3')" class="Editor-button" value="同意" />
		<input type="button" onclick="submitContent('4')" class="button-gray" value="不同意" />
	</div>
	</#if>
	<script src="${s.base}/js/jquery-3.2.0.min.js"></script>

	<script  type="application/javascript" src="${s.base}/js/layer/layer.js" ></script>
	<script  type="application/javascript" src="${s.base}/js/layer/commont.js" ></script>
	<script type="text/javascript">
        function submitContent(status){
            var leaveId=$("#leaveId").val();



            var url="${s.base}/mobile/leaveCheck";
            var params = {
                status: status,
                leaveId: leaveId
            };
            //调用了jquery.json 库
			/* var encoded = $.toJSON( request );
			 var jsonStr = encoded;*/
            $.ajax({
                url : url,
                type : 'POST',
                data : params,
                dataType : 'json',
                //contentType : 'application/json',
                success : function(data, status, xhr) {
                    if(1==data.returnInfo.state){
                        layer.open({
                            type: 1
                            ,title: "温馨提示"
                            ,offset: "auto" //具体配置参考：http://www.layui.com/doc/modules/layer.html#offset
                            ,id: 'LAY_demoauto' //防止重复弹出
                            ,content: '<div style="padding: 20px 100px;">操作成功</div>'
                            ,btn: "确定"
                            ,btnAlign: 'c' //按钮居中
                            ,shade: 0 //不显示遮罩
                            ,yes: function(){
                                location.href="/mobile/leave?personType="+$("#personType").val()+"&id="+$("#id").val();
                            }
                        });

                    }else{
                        offset("auto",data.returnInfo.errorMsg,"温馨提示","确定");
                    }

                },
                Error : function(xhr, error, exception) {
                    // handle the error.
                    offset("auto",exception.toString(),"温馨提示","确定");
                }
            });
        }
	</script>
</body>
</html>
